home *** CD-ROM | disk | FTP | other *** search
-
- LISTING 1
-
- /* Connect a host with the network */
-
- #include <sys/types.h>
- #include "pctcp/types.h"
- #include "pctcp/pctcp.h"
- #include "pctcp/sockets.h"
- #include "pctcp/error.h"
-
- int connect(long addr)
- {
- int nd; /* network descriptor */
-
- struct addr a;
-
- a.fhost = addr;
- a.fsocket = SOCK_TCP_FTP;
- a.lsocket = 0;
- a.protocol = STREAM;
-
- nd = net_connect(-1,STREAM, &a);
- if (nd == -1) {
- pneterror("net_connect");
- exit(1);
- }
- return nd;
- }
-
-